package com.app114.app.android.rk;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.WebView;
import android.widget.LinearLayout;

import com.app114.app.android.rk.webkit.ExtendedWebViewClient;
import com.app114.app.android.rk.webkit.ExtendedWebViewClient.WebClientListener;
import com.app114.app.android.rk.widget.ExtendedWebView;
import com.waps.AdView;
import com.waps.MiniAdView;

public class BrowsingHistory extends Fragment implements WebClientListener {
	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
		final View view = inflater.inflate(R.layout.layout_web, container, false);
		ExtendedWebView mWebview = (ExtendedWebView) view.findViewById(R.id.webview);
		mWebview.setWebViewClient(new ExtendedWebViewClient(this));
		mWebview.loadUrl("file:///android_asset/BrowsingHistory.html");

		LinearLayout mini = new LinearLayout(getActivity());
		new MiniAdView(getActivity(), mini).DisplayAd(10) ;
		mini.setBackgroundResource(android.R.color.background_dark) ;
		((ViewGroup) view).addView(mini);

		// AdView adView=new AdView(getActivity(), Conf.DIANDONG);
		// ((ViewGroup) view).addView(adView);
		// adView.setAdListener(new AdListener() {
		// @Override
		// public void receiveSucceed() {
		// // Log.d(TAG, "接收广告成功！");
		// }
		// @Override
		// public void receiveFailed() {
		// // Log.d(TAG, "接收广告失败！");
		// }
		// });
		return view;
	}

	@Override
	public boolean shouldOverrideUrlLoading(WebView view, String url) {
		view.loadUrl(url);
		return true;
	}

}
